Skip to content

修复菜单从编辑切回「新增顶级菜单」保存会出现错误弹窗#722

Merged
zds-s merged 1 commit intomineadmin:masterfrom
luckydog-sunny:fix/menu-form
Apr 17, 2026
Merged

修复菜单从编辑切回「新增顶级菜单」保存会出现错误弹窗#722
zds-s merged 1 commit intomineadmin:masterfrom
luckydog-sunny:fix/menu-form

Conversation

@luckydog-sunny
Copy link
Copy Markdown
Contributor

@luckydog-sunny luckydog-sunny commented Apr 13, 2026

修复菜单从编辑切回「新增顶级菜单」时, 保存会出现错误弹窗:此操作已执行过,请点击左侧菜单重新操作。

修复内容:

 if (data.id) {
    form.value.dataType = 'edit'
 }
// 改为
form.value.dataType = data.id ? 'edit' : 'add';

复现操作:菜单管理 -> 新增顶级菜单 -> (点击任意树菜单)-> 新增顶级菜单 -> 填写数据保存 -> 出现错误弹窗

image

Summary by CodeRabbit

修复

  • 优化了权限菜单表单的状态管理逻辑。在添加和编辑操作中,表单模式的设置现在更加明确和可靠,确保在所有使用场景下都能正确初始化和处理表单数据。

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 13, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c87f31ee-dd81-4188-b613-ff2f32b65a4b

📥 Commits

Reviewing files that changed from the base of the PR and between 86dc71e and 4673cdb.

📒 Files selected for processing (1)
  • web/src/modules/base/views/permission/menu/menu-form.vue

📝 Walkthrough

演练

更新了 menu-form.vuesetData 函数的逻辑,使用三元表达式 data.id ? 'edit' : 'add' 显式设置 form.value.dataType,替代之前仅在 data.id 存在时才切换到 'edit' 的条件块,现在当 data.id 为假值时显式强制设置为 'add'

变更

内聚组 / 文件 摘要
菜单表单数据类型逻辑
web/src/modules/base/views/permission/menu/menu-form.vue
使用三元表达式将 form.value.dataType 的赋值改为显式条件判断,基于 data.id 的存在性决定为 'edit''add',简化了控制流逻辑。

预估代码审查工作量

🎯 2 (简单) | ⏱️ ~8 分钟

相关的可能性 PR

建议标签

bug, Frontend, size:XS

建议审阅者

  • zds-s

🐰 菜单表单焕新颜,
三元若道亮堂堂,
编辑添加显分明,
逻辑简洁代码棒!
小小改动大智慧~

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 拉取请求标题准确反映了变更集的主要内容——修复菜单从编辑模式切回「新增」模式时的表单数据类型错误。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dosubot dosubot Bot added the bug label Apr 13, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 17, 2026
@zds-s zds-s merged commit 7c75b38 into mineadmin:master Apr 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Frontend lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants